//
// Created by ashCheng on 2022/12/2.
//
#include <iostream>
#include "Sales_item.h"

int main() {
  Sales_item temp, sum;
  std::cin >> temp;
  sum = temp;
  while (std::cin >> temp) {
    if (temp.isbn() == sum.isbn()) {
      sum += temp;
    } else {
      std::cout << "Different isbn." << std::endl;
      return -1;
    }
  }
  std::cout << "Sum: " << sum << std::endl;
  return 0;
}